import django_filters

from .models import UserModel


class UserFilter(django_filters.FilterSet):
    user_name = django_filters.CharFilter(lookup_expr='icontains')
    full_name = django_filters.CharFilter(lookup_expr='icontains')
    is_active = django_filters.BooleanFilter()
    create_datetime_start = django_filters.DateTimeFilter(field_name='create_datetime', lookup_expr='gt')
    create_datetime_end = django_filters.DateTimeFilter(field_name='create_datetime', lookup_expr='lt')

    class Meta:
        model = UserModel
        fields = ['user_name', 'full_name', 'is_active', 'create_datetime']
